with open("Walden.txt","r+") as fp:
    lst1 = fp.readlines()
    lst2 = []
    for a in lst1:
        for i, j in enumerate(a):
            if not j.isalpha():
                a = a.replace(f'{j}', ' ')
        a = a.split(' ')
        for x in a:
            if x.isalpha():
                x = x.lower()
                lst2.append(x)
    dct = dict()
    for word in lst2:
        if word not in dct.keys():
            word_count = lst2.count(word)
            dct[word] = word_count
    print(dct)
